package cn.zindesign.system;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.zindesign.utils.S;


public class Page {
	  private static final Log logger = LogFactory.getLog(Page.class);

	  HttpServletRequest request = null;
	  String filename = ""; 
	  int page = 1; 
	  long totals = -1; 
	  int perpagenum = 20; 
	  int style = 0; 
	  /**
	 * @return the prePage
	 */
	public int getPrePage() {
		return prePage;
	}

	/**
	 * @param prePage the prePage to set
	 */
	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}

	/**
	 * @return the nextPage
	 */
	public int getNextPage() {
		return nextPage;
	}

	/**
	 * @param nextPage the nextPage to set
	 */
	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	int allpage = 1; 
	  int prePage = 1;
	  int nextPage = 1;
	  /**
	 * @return the allpage
	 */
	public int getAllpage() {
		return allpage;
	}

	int cpage = 1; 
	  int spage = 0; 
	  String searchname = ""; //��ѯ�����
	  String listPageBreak = "";
	  String[] pagesign = {"首页", "上一页", "下一页", "尾页"};
	  int infostart = 0;    //��ʼ��¼��

	  public Page() {
	  }

	  /**
	   * Pages�ľ����������е�����ʹ�ñ�����Ĭ�ϵ�����
	   * @param request HttpServletRequest
	   */
	  public Page(HttpServletRequest request) {
	    this.request = request;
	    this.pagesign = pagesign;
	    this.page = S.strToInt(request.getParameter("page"));
	    this.totals = S.strToLong(request.getParameter("t"));
	    String servletPath = request.getServletPath();
	    if(servletPath.indexOf("/info/issueInfoAction.do") < 0
	    		&& servletPath.indexOf("/info/infoAuditAction.do") < 0
	    	        && servletPath.indexOf("/info/comment.jsp") < 0 ) {
	    	searchname = S.getQueryString(request);  
	    } 
	  }

	  //���extjs���ҳ����
	  public Page(int start,int limit,HttpServletRequest request) {
	      this.request = request;
	      this.pagesign = pagesign;
	      this.page = start/limit+1;
	  }

	  /**
	   * Pages�����������������ô���Ĳ���
	   * @param request HttpServletRequest
	   * @param page int ��ǰҳ
	   * @param totals int ��¼����
	   * @param perpagenum int ÿҳ��ʾ�ļ�¼��
	   * @param style int ������
	   */

	  public Page(HttpServletRequest request, int page, int totals, int perpagenum,
	               int style) {
	    this.request = request;
	    this.page = page;
	    this.totals = totals;
	    this.perpagenum = perpagenum;
	    this.style = style;
	    this.pagesign = pagesign;
	  }

	  /**
	   * ����Ĭ�Ϸ���Pages������
	   * @param request HttpServletRequest
	   * @param page int
	   * @param totals int
	   * @param perpagenum int
	   */

	  public Page(HttpServletRequest request, int page, int totals, int perpagenum) {
	    this.request = request;
	    this.page = page;
	    this.totals = totals;
	    this.perpagenum = perpagenum;
	    this.pagesign = pagesign;
	  }

	  /**
	   * ʹ��Ĭ�Ϸ���pages������
	   * @param request HttpServletRequest
	   * @param page int
	   * @param perpagenum int
	   */

	  public Page(HttpServletRequest request, int page, int perpagenum) {
	    this.request = request;
	    this.page = page;
	    this.perpagenum = perpagenum;
	    this.pagesign = pagesign;
	  }

	  public String getFileName() {
	    return this.filename;
	  }

	  public void setFileName(String aFileName) {
	    this.filename = aFileName;
	    searchname = S.getQueryFile(searchname);
	    searchname = searchname.trim();
	    if(searchname !="&" && searchname != "") {
	        filename = filename+"?"+searchname;
	    }
	  }

	  public int getPage() {
	    return this.page;
	  }

	  public void setPage(int aPage) {
	    this.page = aPage;
	  }

	  public long getTotals() {
	    return this.totals;
	  }

	  public void setTotals(long aTotals) {
	    this.totals = aTotals;
	  }

	  public int getPerPageNum() {
	    return this.perpagenum;
	  }

	  public void setPerPageNum(int aperpagenum) {
	    this.perpagenum = aperpagenum;
	  }

	  public int getStyle() {
	    return this.style;
	  }

	  public void setStyle(int aStyle) {
	    this.style = aStyle;
	  }

	  public void setPagesign(String[] apagesign) {
	    this.pagesign = apagesign;
	  }

	  public int getSpage() {
	    return this.spage;
	  }

	  public void doPageBreak() {
	      this.allpage = (int) Math.ceil( (this.totals + this.perpagenum - 1) /
	                                     this.perpagenum);
	      int intPage = this.page;
	      if (intPage > this.allpage || intPage == 0) { // pages == 0
	        this.cpage = 1;
	      }
	      else {
	        this.cpage = intPage;
	      }
	      this.spage = (this.cpage - 1) * this.perpagenum;   
	      if(this.totals > this.perpagenum) {
	    	  if(this.infostart > 1) {
	              this.spage += (this.infostart - 1);
	          }
	    	  if(this.totals - this.perpagenum < this.spage) {   
	    		  //��ʼ��¼��0��ʼ
	        	  this.spage = (int)this.totals - this.perpagenum;
	          }
	      } else {
	    	  this.spage = 0;
	    	  if(this.infostart > 1) {
	              this.spage += (this.infostart - 1);
	          }
	      }    
	      if(page==1){
	    	  prePage = 1; 
	    	  nextPage = page + 1;
	      }
	      if(page==allpage&&allpage>1){
	    	  prePage = page-1;
	    	  nextPage = page;
	      }
	      if(page>1&&page<allpage){
	    	  prePage = page - 1; 
	    	  nextPage = page + 1;
	      }
	      getPageBreakStr();
	  }

	  public String getListPageBreak() {
	    return this.listPageBreak;
	  }

	  private void getPageBreakStr() {
	    if (this.filename.indexOf("?") == -1 &&
	        (this.filename.endsWith(".do")) || (this.filename.endsWith(".jsp"))) {
	      this.filename = this.filename + "?";
	    }
	    else {
	      if (!this.filename.endsWith("&")) {
	        this.filename = this.filename + "&";
	      }
	    }
	    StringBuffer sb = new StringBuffer();
	    if (this.style == 0) {
	      this.getNavStyle1(sb);
	      return;
	    }

	    if (this.style == 1) {
	      this.getNavStyle2(sb);
	      return;
	    }

	    if (this.style == 2) {
	      this.getNavStyle3(sb);
	      return;
	    }

	    if (this.style == 3) {
	      this.getNavStyle4(sb);
	      return;
	    }

	    if (this.style == 4) {
	      this.getNavStyle5(sb);
	      return;
	    }
	    if (this.style == 5) {
	      this.getNavStyle5(sb);
	      return;
	    }
	    if (this.style == 6) {
	      this.getNavStyle6(sb);
	      return;
	    }
	    if (this.style == 7) {
	      this.getNavStyle7(sb);
	      return;
	    }
	  }

	  private void getNavStyle6(StringBuffer sb) {
	    String postto;
	    sb.append(
	        "<table border=\"0\" Style=\"width:98%\" align=center cellpadding=0 cellspacing=2 class=tableBorder5><tr align=center>");

	    int index = filename.indexOf("?");
	    if (index != -1) {
	      postto = filename.substring(0, index);
	      filename = filename.substring(index + 1, filename.length());
	    }
	    else {
	      postto = filename;
	      filename = "";
	    }
	    sb.append("<FORM METHOD=POST ACTION=\"?" + filename + "\">\n");
	    if (filename != null && filename.length() > 0) {
	      String[] ss = filename.split("&");
	      if (ss != null) {
	        for (int i = 0; i < ss.length; i++) {
	          String[] p = ss[i].split("=");
	          if (p != null && p.length == 2) {
	            sb.append("<INPUT TYPE=\"hidden\" name=\"" + p[0] +
	                      "\" value=\"" +
	                      p[1] + "\">\n");

	          }
	        }
	      }
	    }

	    if (filename != null && filename.length() > 0) {
	      filename = postto + "?" + filename;
	    }
	    else {
	      filename = postto+"?";
	    }
	    sb.append("<td class=tabletitle1><nobr>&nbsp;����<b>" + totals + "</b>&nbsp;</nobr></td>");
	    sb.append("<td class=tabletitle1><nobr>&nbsp;ҳ�Σ�<b>" + cpage + "/" + allpage + "</b>&nbsp;</nobr></td><td>");
	    sb.append(this.getPageStr(10,  2));
	    sb.append("<td class=tablebody1><nobr><input name=page value=" + cpage +
	              " type=text size=2 class=INPUT1> ҳ <input type=submit name=Submit class=BUTTN-FIX1 value=GO></nobr></td>");
	    sb.append("</FORM></tr></table>");
	    this.listPageBreak = sb.toString();
	  }

	  private void getNavStyle7(StringBuffer sb) {
	    String postto;
	    sb.append(
	        "<table border=\"0\" Style=\"width:98%\" align=center cellpadding=0 cellspacing=2 class=tableBorder5><tr align=center>");

	    int index = filename.indexOf("?");
	    if (index != -1) {
	      postto = filename.substring(0, index);
	      filename = filename.substring(index + 1, filename.length());
	    }
	    else {
	      postto = filename;
	      filename = "";
	    }
	    sb.append("<FORM METHOD=POST ACTION=\"?" + filename + "\">\n");
	    if (filename != null && filename.length() > 0) {
	      String[] ss = filename.split("&");
	      if (ss != null) {
	        for (int i = 0; i < ss.length; i++) {
	          String[] p = ss[i].split("=");
	          if (p != null && p.length == 2) {
	            sb.append("<INPUT TYPE=\"hidden\" name=\"" + p[0] +
	                      "\" value=\"" +
	                      p[1] + "\">\n");

	          }
	        }
	      }
	    }

	    if (filename != null && filename.length() > 0) {
	      filename = postto + "?" + filename;
	    }
	    else {
	      filename = postto+"?";
	    }
	    sb.append("<td class=tabletitle1><nobr>&nbsp;����<b>" + totals + "</b>&nbsp;</nobr></td>");
	    sb.append("<td class=tabletitle1><nobr>&nbsp;ҳ�Σ�<b>" + cpage + "/" + allpage + "</b>&nbsp;</nobr></td><td>");
	    sb.append(this.getPageStr(10,  1));
	    sb.append("<td class=tablebody1><nobr><input name=page value=" + cpage +
	              " type=text size=2 class=INPUT1> ҳ <input type=submit name=Submit class=BUTTN-FIX1 value=GO></nobr></td>");
	    sb.append("</tr></FORM></table>");
	    this.listPageBreak = sb.toString();
	  }

	  public String getPageStr(int n, int v) {
	    String PageStr = "";
	    int p = 0;
	    int i = 0;
	    if ( (cpage - 1) % n == 0) {
	      p = (cpage - 1) / n;
	    }
	    else {
	      p = ( ( (cpage - 1) - (cpage - 1) % n) / n);
	    }

	    switch (v) {
	      case 1:
	        if (cpage != 1) {
	          PageStr += "<a href=\"" + filename + "page=1&t=" + totals + "\" title=\"��ҳ\"><img src=\"/images/pagelist/First.gif\" border=\"0\" alt=\"��һҳ\"></a>";
	        }
	        if (p * n > 0) {
	          PageStr += "<a href=\"" + filename + "page=" + p * n +
	              "&t=" + totals + "\" title=\"��ʮҳ\"><img src=\"/images/pagelist/Previous.gif\" border=\"0\"></a>";
	        }
	        for (i = p * n + 1; i < p * n + n + 1; i++) {
	          if(this.allpage == 0) break;
	          if (i == cpage) {
	            PageStr += " <font color=\"red\">[" + i + "]</font> ";
	          }
	          else {
	            PageStr += " <a href=\"" + filename + "page=" + i + "&t=" + totals + "\">" + i + "</a> ";
	          }
	          if (i == this.allpage)break;
	        }

	        //PageStr += "</b>";
	        if (i < this.allpage) {
	          PageStr += "<a href=\"" + filename + "page=" + i +
	              "&t=" + totals + "\" title=\"��ʮҳ\"><img src=\"/images/pagelist/Next.gif\" border=\"0\"></a>";
	        }
	        if (cpage != this.allpage) {
	          PageStr += "<a href=\"" + filename + "page=" + this.allpage +
	              "&t=" + totals + "\" title=\"βҳ\"><img src=\"/images/pagelist/Last.gif\" border=\"0\"></a>";
	        }
	        break;
	      case 2:
	        if (cpage != 1) {
	          PageStr += "<td class=tablebody1>&nbsp;<a href=\"" + filename + "page=1&t=" + totals +
	              "\" title=\"��һҳ\"><img src=\"/images/pagelist/First.gif\" border=\"0\" alt=\"��һҳ\"></a>&nbsp;</td>";
	        }
	        if (p * n > 0) {
	          PageStr += "<td class=tablebody1>&nbsp;<a href=\"" + filename + "page=" + p * n +
	              "&t=" + totals + "\" title=\"��ʮҳ\"><img src=\"/images/pagelist/Previous.gif\" border=\"0\"></a>&nbsp;</td>";
	        }
	        for (i = p * n + 1; i < p * n + n + 1; i++) {
	          if(this.allpage == 0) break;
	          if (i == cpage) {
	            PageStr += " <td class=tablebody2>&nbsp;<B><font color=\"red\">" + i + "</font></B></td> ";
	          }
	          else {
	            PageStr += " <td class=tablebody1>&nbsp;<a href=\"" + filename + "page=" + i + "&t=" + totals +
	                "\">" + i + "</a>&nbsp;</td>";
	          }
	          if (i == this.allpage)break;
	        }
	        if (i < this.allpage) {
	          PageStr += "<td class=tablebody1>&nbsp;<a href=\"" + filename + "page=" + i + "&t=" + totals +
	              "\" title=\"��ʮҳ\"><img src=\"/images/pagelist/Next.gif\" border=\"0\"></a>&nbsp;</td>";
	        }
	        if (cpage != this.allpage) {
	          PageStr += "<td class=tablebody1>&nbsp;<a href=\"" + filename + "page=" + this.allpage + "&t=" + totals +
	              "\" title=\"βҳ\"><img src=\"/images/pagelist/Last.gif\" border=\"0\"></a>&nbsp;";
	        }
	        break;
	    }
	    return PageStr;
	  }

	  private void getNavStyle5(StringBuffer sb) {
	    int _cpage = 0;
	    if (this.allpage == 0) {
	      _cpage = 0;
	    }
	    else {
	      _cpage = cpage;
	    }
	    sb.append("�� " + this.totals + " �� �� " + _cpage + "/" + this.allpage +
	              " ҳ");
	    if (cpage > allpage || cpage <= 1) {
	      sb.append("&nbsp;" + pagesign[0] + "&nbsp;");
	    }
	    else {
	      sb.append("&nbsp;<a href='" + this.filename + "page=1'>" + pagesign[0] +
	                "</a>&nbsp;");
	    }
	    if (cpage <= 1 || cpage > allpage) {
	      sb.append("&nbsp;" + pagesign[1] + "&nbsp;");
	    }
	    else {
	      sb.append("&nbsp;<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append( (cpage - 1));
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>" + pagesign[1] + "</a>&nbsp;");
	    }
	    if (cpage == allpage || cpage > allpage || cpage < 1) {
	      sb.append("&nbsp;" + pagesign[2] + "&nbsp;");

	    }
	    else {
	      sb.append("&nbsp;<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append( (cpage + 1));
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>" + pagesign[2] + "</a>&nbsp;");
	    }
	    if (cpage == allpage || cpage > allpage || cpage < 1) {
	      sb.append("&nbsp;" + pagesign[3] + "&nbsp;");
	    }
	    else {
	      sb.append("&nbsp;<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append(this.allpage);
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>" + pagesign[3] + "</a>&nbsp;");
	    }
	    this.listPageBreak = sb.toString();

	  }

	  /**
	   * ��ʽһ
	   * ���
	   * [<a href='action.do?&page=1' >��ҳ</a>]
	   *  [<a href='action.do?&page=1&t=60'>��һҳ</a>]
	   *  [<a href='action.do?&page=3' >��һҳ</a>]
	   *  [<a href='action.do?&page=3&t=60' >βҳ</a>]
	   */
	  private void getNavStyle1(StringBuffer sb) {
	    if (this.cpage > 1) {
	      sb.append("[<a href='");
	      sb.append(this.filename);
	      sb.append("page=1' >");
	      sb.append(pagesign[0]);
	      sb.append("</a>] [<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append( (cpage - 1));
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>");
	      sb.append(pagesign[1]);
	      sb.append("</a>] ");
	      this.listPageBreak = sb.toString();
	    }
	    if (this.cpage < this.allpage) {
	      sb.append("[<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append( (cpage + 1));
	      sb.append("' >");
	      sb.append(pagesign[2]);
	      sb.append("</a>] [<a href='");
	      sb.append(this.filename);
	      sb.append("page=");
	      sb.append(this.allpage);
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new

	      sb.append("' >");
	      sb.append(pagesign[3]);
	      sb.append("</a>] ");
	      this.listPageBreak = sb.toString();
	    }
	  }

	  /**
	   * ��ʽ��
	   * ���
	   * [<a href='action.do?&page=1&t=60'>��ҳ</a>]
	   * [<a href='action.do?&page=1&t=60'>��һҳ</a>]
	   *  [<a href='action.do?&page=3&t=60'>��һҳ</a>]
	   *  [<a href='action.do?&page=3&t=60'>βҳ</a>]
	   *  �� {60} �� �� {2}/{3} ҳ
	   */
	  private void getNavStyle2(StringBuffer sb) {
	    try {
	      if (this.cpage > 1) {
	        sb.append("[<a href='");
	        sb.append(this.filename);
	        sb.append("page=1");
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[0]);
	        sb.append("</a>] [<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append( (cpage - 1));
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[1]);
	        sb.append("</a>] ");

	      }
	      if (this.cpage < this.allpage) {

	        sb.append("[<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append( (cpage + 1));
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[2]);
	        sb.append("</a>] [<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append(this.allpage);
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new

	        sb.append("'>");
	        sb.append(pagesign[3]);
	        sb.append("</a>] ");

	      }
	      int _cpage = 0;
	      if (this.allpage == 0) {
	        _cpage = 0;
	      }
	      else {
	        _cpage = cpage;
	      }
	      sb.append("�� [" + this.totals + "] �� �� " + _cpage + "/" + this.allpage +
	                " ҳ");
	      this.listPageBreak = sb.toString();
	      return;
	    }
	    catch (Exception e) {

	    }
	  }

	  /**
	   * ��ʽ��
	   * ���
	   * [<a href='action.do?&inpages=1&t=60'>��ҳ</a>]
	   *  [<a href='action.do?&inpages=1&t=60'>��һҳ</a>]
	   * [<a href='action.do?&inpages=3&t=60'>��һҳ</a>]
	   * [<a href='action.do?&inpages=3&t=60'>βҳ</a>]
	   *  �� {60} �� �� {2}/{3} ҳ
	   */
	  private void getNavStyle3(StringBuffer sb) {
	    if (this.cpage > 1) {
	      sb.append("[<a href='");
	      sb.append(this.filename);
	      sb.append("inpages=1");
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>");
	      sb.append(pagesign[0]);
	      sb.append("</a>] [<a href='");
	      sb.append(this.filename);
	      sb.append("inpages=");
	      sb.append( (cpage - 1));
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>");
	      sb.append(pagesign[1]);
	      sb.append("</a>] ");
	    }
	    if (this.cpage < this.allpage) {
	      sb.append("[<a href='");
	      sb.append(this.filename);
	      sb.append("inpages=");
	      sb.append( (cpage + 1));
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>");
	      sb.append(pagesign[2]);
	      sb.append("</a>] [<a href='");
	      sb.append(this.filename);
	      sb.append("inpages=");
	      sb.append(this.allpage);
	      //new
	      sb.append("&t=");
	      sb.append(this.totals);
	      //new
	      sb.append("'>");
	      sb.append(pagesign[3]);
	      sb.append("</a>] ");
	    }
	    int _cpage = 0;
	    if (this.allpage == 0) {
	      _cpage = 0;
	    }
	    else {
	      _cpage = cpage;
	    }
	    sb.append("�� {" + this.totals + "} �� �� {" + _cpage + "}/{" + this.allpage +
	              "} ҳ");
	    this.listPageBreak = sb.toString();

	  }

	  /**
	   * ��ʽ��
	   * ���
	   * <table width="100%"  border="0" cellpadding="0" cellspacing="0">
	   * <FORM METHOD=POST ACTION="action.do">
	   * <tr><td><div align="right">
	   * [<a href='action.do?&page=1&t=60'>��ҳ</a>] [<a href='action.do?&page=1&t=60'>��һҳ</a>]
	   * [<a href='action.do?&page=3&t=60'>��һҳ</a>] [<a href='action.do?&page=3&t=60'>βҳ</a>]
	   * �� {60} �� �� {2}/{3} ҳ
	   * �� <input name=page type=text size=2 class=INPUT1> ҳ
	   * <input type=submit name=Submit class=BUTTN-FIX1 value=GO></div></td></tr>
	   * </FORM>
	   * </table>
	   */
	  private void getNavStyle4(StringBuffer sb) {
	    String postto;
	    if (this.filename != null && this.filename.length() > 0) {

	      sb.append(
	          "<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
	      //filename = filename.toLowerCase();
	      int index = filename.indexOf("?");
	      if (index != -1) {
	        postto = filename.substring(0, index);
	        filename = filename.substring(index + 1, filename.length());
	      }
	      else {
	        postto = filename;
	        filename = "";
	      }
	      sb.append("<FORM METHOD=POST ACTION=\"" + postto + "\">\n");
	      sb.append("<tr><td><div align=\"right\">\n");
	      if (filename != null && filename.length() > 0) {
	        String[] ss = filename.split("&");
	        if (ss != null) {
	          for (int i = 0; i < ss.length; i++) {
	            String[] p = ss[i].split("=");
	            if (p != null && p.length == 2) {
	              sb.append("<INPUT TYPE=\"hidden\" name=\"" + p[0] +
	                        "\" value=\"" +
	                        p[1] + "\">\n");

	            }
	          }
	        }
	      }

	      if (filename != null && filename.length() > 0) {
	        filename = postto + "?" + filename;
	      }
	      else {
	        filename = postto;
	      }

	      if (this.cpage > 1) {
	        sb.append("[<a href='");
	        sb.append(this.filename);
	        sb.append("page=1");
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[0]);
	        sb.append("</a>] [<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append( (cpage - 1));
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[1]);
	        sb.append("</a>] ");

	      }
	      if (this.cpage < this.allpage) {
	        sb.append("[<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append( (cpage + 1));
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[2]);
	        sb.append("</a>] [<a href='");
	        sb.append(this.filename);
	        sb.append("page=");
	        sb.append(this.allpage);
	        //new
	        sb.append("&t=");
	        sb.append(this.totals);
	        //new
	        sb.append("'>");
	        sb.append(pagesign[3]);
	        sb.append("</a>] ");

	      }
	      int _cpage = 0;
	      if (this.allpage == 0) {
	        _cpage = 0;
	      }
	      else {
	        _cpage = cpage;
	      }
	      sb.append("�� {" + this.totals + "} �� �� {" + _cpage + "}/{" + this.allpage +
	                "} ҳ");
	      sb.append(" ");
	      sb.append(
	          "�� <input name=page type=text size=2 class=INPUT1> ҳ <input type=submit name=Submit class=BUTTN-FIX1 value=GO>");
	      sb.append("</div></td></tr>\n");
	      sb.append("</FORM>\n");
	      sb.append("</table>\n");

	      this.listPageBreak = sb.toString();
	    }

	  }

	  public HttpServletRequest getRequest() {
	    return request;
	  }

	    public int getCpage() {
	        return cpage;
	    }

	    public int getInfostart() {
	        return infostart;
	    }

	    public void setRequest(HttpServletRequest request) {
	    this.request = request;
	  }

	    public void setSpage(int spage) {
	        this.spage = spage;
	    }

	    public void setCpage(int cpage) {
	        this.cpage = cpage;
	    }

	    public void setInfostart(int infostart) {
	        this.infostart = infostart;
	    }

}
